{template 'web/_header'}
{template 'web/sysset/tabs'}
<div class="main">
    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data" >
        <input type='hidden' name='setid' value="{$set['id']}" />
        <input type='hidden' name='op' value="pay" />
        <div class="panel panel-default"> 
            <div class='panel-body'>

                <div class='alert alert-info'>
                    在开启以下支付方式前，请到 <a href='{php echo url('profile/payment')}'>支付选项</a> 去设置好参数。
                </div>

                <div class="form-group">

                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">微信支付</label>
                    <div class="col-sm-9 col-xs-12">
                        {ifp 'sysset.save.pay'}
                        <label class='radio-inline'><input type='radio' name='pay[weixin]' value='1' {if $set['pay']['weixin']==1}checked{/if}/> 开启</label>
                        <label class='radio-inline'><input type='radio' name='pay[weixin]' value='0' {if $set['pay']['weixin']==0}checked{/if} /> 关闭</label>
                        {else}
                        <input type="hidden" name="pay[weixin]" value="{$set['pay']['weixin']}" />
                        <div class='form-control-static'> {if $set['pay']['weixin']==1}开启{else}关闭{/if}</div>
                        {/if}
                    </div>
                </div>
                <div id='certs' {if empty($set['pay']['weixin'])}style="display:none"{/if}>
                     <div class="form-group">
                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">CERT证书文件</label>
                        <div class="col-sm-9 col-xs-12">
                            <input type="hidden" name="pay[weixin_cert]" value="{$set['pay']['weixin_cert']}"/>
                            {ifp 'sysset.save.pay'}

                            <input type="file" name="weixin_cert_file" class="form-control" />
                            <span class="help-block">
                                {if !empty($set['pay']['weixin_cert'])}
                                <span class='label label-success'>已上传</span>
                                {else}
                                <span class='label label-danger'>未上传</span>
                                {/if}
                                下载证书 cert.zip 中的 apiclient_cert.pem 文件</span>
                            {else}
                            {if !empty($set['pay']['weixin_cert'])}
                            <span class='label label-success'>已上传</span>
                            {else}
                            <span class='label label-danger'>未上传</span>
                            {/if}
                            {/if}

                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">KEY密钥文件</label>
                        <div class="col-sm-9 col-xs-12">
                            <input type="hidden" name="pay[weixin_key]"  value="{$set['pay']['weixin_key']}"/>
                            {ifp 'sysset.save.pay'}

                            <input type="file" name="weixin_key_file" class="form-control" />
                            <span class="help-block">
                                {if !empty($set['pay']['weixin_key'])}
                                <span class='label label-success'>已上传</span>
                                {else}
                                <span class='label label-danger'>未上传</span>
                                {/if}
                                下载证书 cert.zip 中的 apiclient_key.pem 文件
                            </span>
                            {else}
                            {if !empty($set['pay']['weixin_key'])}
                            <span class='label label-success'>已上传</span>
                            {else}
                            <span class='label label-danger'>未上传</span>
                            {/if}
                            {/if}
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-12 col-sm-3 col-md-2 control-label">ROOT文件</label>
                        <div class="col-sm-9 col-xs-12">
                            <input type="hidden" name="pay[weixin_root]" value="{$set['pay']['weixin_root']}"/>
                            {ifp 'sysset.save.pay'}

                            <input type="file" name="weixin_root_file" class="form-control" />
                            <span class="help-block">
                                {if !empty($set['pay']['weixin_root'])}
                                <span class='label label-success'>已上传</span>
                                {else}
                                <span class='label label-danger'>未上传</span>
                                {/if}
                                下载证书 cert.zip 中的 rootca.pem.pem 文件 
                            </span>
                            {else}
                            {if !empty($set['pay']['weixin_root'])}
                            <span class='label label-success'>已上传</span>
                            {else}
                            <span class='label label-danger'>未上传</span>
                            {/if}
                            {/if}
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">支付宝支付</label>
                    <div class="col-sm-9 col-xs-12">
                        {ifp 'sysset.save.pay'}
                        <label class='radio-inline'><input type='radio' name='pay[alipay]' value='1' {if $set['pay']['alipay']==1}checked{/if}/> 开启</label>
                        <label class='radio-inline'><input type='radio' name='pay[alipay]' value='0' {if $set['pay']['alipay']==0}checked{/if} /> 关闭</label>
                        {else}
                        <input type="hidden" name="pay[alipay]" value="{$set['pay']['alipay']}"/>
                        <div class='form-control-static'> {if $set['pay']['alipay']==1}开启{else}关闭{/if}</div>
                        {/if}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">银联支付</label>
                    <div class="col-sm-9 col-xs-12">
                        {ifp 'sysset.save.pay'}
                        <label class='radio-inline'><input type='radio' name='pay[unionpay]' value='1' {if $set['pay']['unionpay']==1}checked{/if}/> 开启</label>
                        <label class='radio-inline'><input type='radio' name='pay[unionpay]' value='0' {if $set['pay']['unionpay']==0}checked{/if} /> 关闭</label>
                        {else}
                        <input type="hidden" name="pay[alipay]" value="{$set['pay']['alipay']}"/>
                        <div class='form-control-static'> {if $set['pay']['unionpay']==1}开启{else}关闭{/if}</div>
                        {/if}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">余额支付</label>
                    <div class="col-sm-9 col-xs-12">
                        {ifp 'sysset.save.pay'}
                        <label class='radio-inline'><input type='radio' name='pay[credit]' value='1' {if $set['pay']['credit']==1}checked{/if}/> 开启</label>
                        <label class='radio-inline'><input type='radio' name='pay[credit]' value='0' {if $set['pay']['credit']==0}checked{/if} /> 关闭</label>
                        {else}
                        <input type="hidden" name="pay[credit]" value="{$set['pay']['credit']}"/>
                        <div class='form-control-static'> {if $set['pay']['credit']==1}开启{else}关闭{/if}</div>
                        {/if}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">货到付款</label>
                    <div class="col-sm-9 col-xs-12">
                        {ifp 'sysset.save.pay'}
                        <label class='radio-inline'><input type='radio' name='pay[cash]' value='1' {if $set['pay']['cash']==1}checked{/if}/> 开启</label>
                        <label class='radio-inline'><input type='radio' name='pay[cash]' value='0' {if $set['pay']['cash']==0}checked{/if} /> 关闭</label>
                        {else}
                        <input type="hidden" name="pay[cash]" value="{$set['pay']['cash']}"/>
                        <div class='form-control-static'> {if $set['pay']['cash']==1}开启{else}关闭{/if}</div>
                        {/if}
                    </div>
                </div>
                
                       <div class="form-group"></div>
            <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
                    <div class="col-sm-9 col-xs-12">
                           {ifp 'sysset.save.pay'}
                            <input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1"  />
                            <input type="hidden" name="token" value="{$_W['token']}" />
                          {/if}
                     </div>
            </div>

            </div>
            <script language="javascript">
                $(function () {
                    $(":radio[name='pay[weixin]']").click(function () {
                        if ($(this).val() == 1) {
                            $("#certs").show();
                        }
                        else {
                            $("#certs").hide();
                        }
                    })

                })
            </script>
        </div>     
    </form>
</div>
{template 'web/_footer'}     